/*
 * Copyright (c) 2016 4PX Information Technology Co.,Ltd. All rights reserved.
 */
package com.open.basics.thread;

import java.util.ArrayList;
import java.util.List;

/**
 * 断点调试
 * 
 * @author hcx
 * @date 2018年3月8日
 */
public class ThreadTest {

    public static void main(String[] args) {
        test();
        Thread1 thread1 = new Thread1();
        Thread2 thread2 = new Thread2();
        thread1.start();
        thread2.start();
        System.out.println("end");

    }

    public static void test() {
        int b = 111;
        int a = 12 + 5222 + b;
        System.out.println(a);
    }

}

class Thread1 extends Thread {
    @Override
    public void run() {
        List<String> lists = new ArrayList<>();
        String nullStr = null;
        lists.add("a");
        lists.add("b");
        lists.add("c");
        lists.add("d");
        lists.add(nullStr);
        try {
            for (String str : lists) {
                if (str.equals("a")) {
                    System.out.println("str==" + str);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

class Thread2 extends Thread {
    @Override
    public void run() {
        List<String> lists = new ArrayList<>();
        String nullStr = null;
        lists.add("a");
        lists.add("b");
        lists.add("c");
        lists.add("d");
        lists.add(nullStr);
        try {
            for (String str : lists) {
                if (str.equals("a")) {
                    System.out.println("str==" + str);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}